<template>
  <n-modal v-model:show="show"
           class="w-11/12 max-w-md "
           preset="card"
           @afterLeave="handleAfterLeave"
           :bordered="false">
    <n-input ref="inputRef"
             type="textarea"
             :autosize="{
              minRows: 5,
              maxRows: 10}"
             v-model:value="content"
    ></n-input>
  </n-modal>
</template>

<script setup lang="ts">
import {nextTick, ref} from "vue";

const inputRef = ref()
const content = ref('')
const show = ref(false)

const emits = defineEmits(['afterLeave'])

const handleAfterLeave=()=>{

  emits('afterLeave',content.value)
}
const doParamsShow = (val: string) => {
  content.value = val
  show.value = true
  nextTick(() => {
    inputRef.value.focus()
  })
}
const doShow = () => {
  show.value = true
}
const doHide = () => {
  show.value = false
}
defineExpose({
  doShow,
  doHide,
  doParamsShow
})

</script>

<style scoped>

</style>